package com.ayoka.parenting.ui.grown.list;

import android.support.v4.app.DialogFragment;
import android.support.v4.app.FragmentManager;
import android.text.TextUtils;
import android.view.Gravity;
import android.view.ViewGroup;

import com.ayoka.parenting.Constants;
import com.ayoka.parenting.R;
import com.ayoka.parenting.bean.BaseResponse;
import com.ayoka.parenting.bean.ClassroomBean;
import com.ayoka.parenting.interf.SimpleRequestCallback;
import com.ayoka.parenting.mvp.BasePresenterImpl;
import com.ayoka.parenting.widget.ConfirmDialog;
import com.ayoka.parenting.widget.NotificationDialog;
import com.jincp.common.dialog.DialogDismissListener;
import com.jincp.common.dialog.DialogResultListener;
import com.jincp.common.utils.UIUtils;

import java.util.List;

/**
 * @ProjectName: MVPPlugin.
 * @ClassName: GrownListPresenter.
 * @Description: .
 * @Author: jincp.
 * @CreateDate: 2019/10/10 18:17.
 */
public class GrownListPresenter extends BasePresenterImpl<GrownListContract.View> implements GrownListContract.Presenter{

    private GrownListModel model;

     public GrownListPresenter() {
        model = new GrownListModel();
     }

    @Override
    public void getAllClassRoomListData(int classroomType) {
        mView.get().showWaitDialog(UIUtils.getString(R.string.loading));
        model.getAllClassRoomListData(this, classroomType, new SimpleRequestCallback<List<ClassroomBean>>() {
            @Override
            public void onSuccess(List<ClassroomBean> data) {
                if (!isAttached()) return;
                mView.get().hideWaitDialog();
                mView.get().configAllClassRoomListData(data);
            }

            @Override
            public void onFailure(int errCode, String errMsg) {
                if (!isAttached()) return;
                mView.get().hideWaitDialog();
                mView.get().showToast(errMsg);
            }
        });
    }
}
